import { post } from "../../../utils/request";
import { getCurrentTenant } from "../../../utils/utils";

const saveMessage = data =>
  post("mgt/msgSource/save", {
    ...data,
    tenantCode: (getCurrentTenant() || { tenantCode: "" }).tenantCode[0]
  });

const saveSendMessage = data =>
  post("mgt/msgSource/add", {
    ...data,
    tenantCode: (getCurrentTenant() || { tenantCode: "" }).tenantCode[0]
  });
const editMessage = data =>
  post("mgt/msgSource/save", {
    ...data,
    tenantCode: (getCurrentTenant() || { tenantCode: "" }).tenantCode[0]
  });

const submitMessage = data =>
  post("mgt/msgSource/add", {
    ...data,
    tenantCode: (getCurrentTenant() || { tenantCode: "" }).tenantCode[0]
  });

const getDetail = data => post("mgt/msgSource/detail", data);

const listMessageTypes = data =>
  post("mgt/msgSource/listMessageTypes", {
    ...data,
    tenantCodeList: (getCurrentTenant() || { tenantCode: "" }).tenantCode
  });
const getSceneList = data =>
  post("mgt/baseMsg/list", {
    ...data,
    tenantCodeList: (getCurrentTenant() || { tenantCode: "" }).tenantCode
  });
const getnoSpecifiedlist = data =>
  post("mgt/msgSource/noSpecifiedlist", {
    ...data,
    tenantCodeList: (getCurrentTenant() || { tenantCode: "" }).tenantCode
  });

const msgSceneLEnabled = data => post("mgt/baseMsg/isEnabled", data);
const msgQueryLog = data => post("mgt/baseMsg/queryLog", data);

export default {
  saveMessage,
  saveSendMessage,
  submitMessage,
  editMessage,
  getDetail,
  listMessageTypes,
  getSceneList,
  getnoSpecifiedlist,
  msgSceneLEnabled,
  msgQueryLog
};
